#include <iostream>

#include <boost/thread.hpp>
#include <boost/asio.hpp>
#include <boost/array.hpp>

#include "octree/octree_rts.hh"

OctreeRts* OctreeRts::oct_ = 0;

const int AI::NOTHING;
const int AI::MOVE;
const int AI::ROTATE;
const int AI::SHOOT;

#include "server.hh"

using boost::asio::ip::tcp;

// class Client
// {
// public:
//   Client (tcp::socket* s):
//     s_ (s)
//   {
//     t_ = boost::thread (&Client::start, this);
//   }

//   void start ()
//   {
//     std::cout << "welcome new client" << std::endl;

//     s_->send (boost::asio::buffer("coucou"));
//     while (1);
//   }

// protected:
//   tcp::socket *s_;
//   boost::thread t_;
// };

int main (int argc, char** argv)
{
  Database* db = new Database ("content/playerdata.db");
  Server s (db);

  OctreeRts::Instance (512);

  if (argc >= 2)
    s.init_rules (argv[1]);
  else
    {
      s.init_map ();
      s.start ();
    }
  delete db;
}
